Skip to content

fix: resolve SonarQube findings (a11y, CI, scripts, regex backtracking) - #73

Open
aamott wants to merge 6 commits into
mainfrom
fix/sonarqube-issues
Open

aamott wants to merge 6 commits into
mainfrom
fix/sonarqube-issues

Conversation

@aamott

@aamott aamott commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Resolve open SonarQube findings across code, CI, and scripts
  • a11y: semantic dialog/section elements in phone breadcrumb; flatten nested ternaries in journal/workspace
  • refactor(core): decompose collectIndexMetadata and the fence masker; remove whitespace ambiguity in TASK_PATTERN
  • fix(sonar): replace fence and inline-code masking regexes with linear scans; tighten WIKI_LINK_PATTERN; suppress false-positive tabIndex finding (scrollable regions require a tab stop for keyboard access)

Test plan

  • pnpm qa — lint, typecheck, 2,925 TS tests, 609 Rust tests all green
  • Masking scans verified byte-identical to the old regexes on edge cases

App code:
- Propagate or report async Disposable.dispose() results instead of
  dropping the promise (bootstrap, extensionPanelMount,
  panelRegistryModel, tabRegistry).
- Replace JSX autoFocus with the dialog system's data-initial-focus /
  ref-focus equivalents, and give interactive ARIA roles the focus
  behavior they require (tree tabIndex, menu tabIndex=-1, scrollable
  region role+tabIndex).
- Drop pointless lazy quantifiers in the wiki-link pattern and collapse
  the inline-code alternation into a single-class lookahead.
- Prefer Number.NaN; wrap .map callbacks explicitly; void two floating
  promises in the example extension.

CI:
- Pin third-party GitHub Actions to full commit SHAs and scope
  contents: write to the jobs that publish releases.
- cargo build --locked for the CodeQL Rust analysis; commit the
  keyring-migration probe's lockfile so its deps are reproducible.

Scripts: use bash [[ ]] conditional tests in rust-env.sh and
sync-cross-android.sh.

Remaining findings were triaged in SonarQube as accepted where the
flag is intentional or generated (Tauri gen/, plan mockups, dev
scripts' PATH resolution, single-class anchored regexes).
…antics

- Extract the field-name problem chain and journal row level/className
  ternaries into explicit if-branches.
- Declare aria-selected on journal treeitems (the tree activates rather
  than selects, so every row reports unselected).
- Use <output> for the managed-storage notice instead of role="status",
  and swap the deprecated FormEvent type for SyntheticEvent.
- The popover is a real <dialog open> now, not role="dialog" on a div;
  the scrollable path row is a labelled <section>. useDismissable takes
  an element-type generic so the ref matches.
- Flatten the metadata sort comparator and unsupported-value diagnostic
  message ternaries in markdown.ts.
- Split collectIndexMetadata into compare/collect/diagnostic helpers,
  dropping cognitive complexity below the sonar threshold.
- Factor the fence-masking regex into its two branches (closed fence,
  then unclosed-to-EOF) — byte-identical output on all edge cases.
- Prefer .at(-1) in the overlay stack helpers.
(?:\s+(\S.*)?)? is equivalent: \s+ and \S.* are disjoint classes, so
the engine has nothing to backtrack over. Only whitespace-only task
text shifts group 2 from '' to undefined, which downstream trim()
normalizes identically.
Replace the fence and inline-code masking regexes with line/offset scans
and tighten WIKI_LINK_PATTERN's capture class, removing the O(n^2)
backtracking SonarQube flagged. The scrollable-region tabIndex is a
false positive, suppressed with justification.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant